<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
</head>
<body>
    <h3>跳出循环  break </h3>

    <script>
        // 循环5次
        // var i = 0 ;
        // 0,1,2,3,4 进入循环体

        for(var i = 0 ; i < 5 ; i++){
            // 判断循环 i == 2 跳出循环
            // console.log("第" + i + "次循环"); //0, 1，2
            if(i == 2) {
                // 跳出循环
                break;
            }
            console.log("第" + i + "次循环"); // 0,1
        }

        // 循环结束，i等于5
        // console.log(i); 5

    </script>
</body>
</html>